home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / cpusetCreate.z / cpusetCreate
Encoding:
Text File  |  2002-10-03  |  12.3 KB  |  265 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))                                              ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetCreate - create a cpuset
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      iiiinnnntttt ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((cccchhhhaaaarrrr ****qqqqnnnnaaaammmmeeee,,,, ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt ****qqqqddddeeeeffff))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_C_r_e_a_t_e function is used to create a cpuset queue.  Only
  18.      processes running root user ID are allowed to create cpuset queues.
  19.  
  20.      The qqqqnnnnaaaammmmeeee argument is the name that will be assigned to the new cpuset.
  21.      The name of the cpuset must be a three to eight character string.  Queue
  22.      names having one or two characters are reserved for use by IRIX.
  23.  
  24.      The qqqqddddeeeeffff argument is a pointer to a ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure (defined
  25.      in <cpuset.h>) that defines the attributes of the queue to be created.
  26.      The memory for the ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt is allocated using
  27.      _c_p_u_s_e_t_A_l_l_o_c_Q_u_e_u_e_D_e_f(3x) and it is released using _c_p_u_s_e_t_F_r_e_e_Q_u_e_u_e_D_e_f(3x).
  28.      The ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure is defined as follows:
  29.  
  30.                typedef struct {
  31.                    int                flags;
  32.                    char               *permfile;
  33.                    cpuset_CPUList_t   *cpu;
  34.                } cpuset_QueueDef_t;
  35.  
  36.  
  37.      ffffllllaaaaggggssss is used to specify various control options for the cpuset queue.
  38.      It is formed by OR-ing together zero or more of the following values:
  39.  
  40.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______CCCC_PPPP_UUUU______EEEE_XXXX_CCCC_LLLL_UUUU_SSSS_IIII_VVVV_EEEE
  41.             Defines a cpuset to be restricted.  Only threads attached to the
  42.             cpuset queue (descendents of an attached thread inherit the
  43.             attachement) may execute on the CPUs contained in the cpuset.
  44.  
  45.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______LLLL_OOOO_CCCC_AAAA_LLLL
  46.             Threads assigned to the cpuset will attempt to assign memory only
  47.             from nodes within the cpuset.  Assignment of memory from outside
  48.             the cpuset will occur only if no free memory is available from
  49.             within the cpuset.  No restrictions are made on memory assignment
  50.             to threads running outside the cpuset.
  51.  
  52.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______EEEE_XXXX_CCCC_LLLL_UUUU_SSSS_IIII_VVVV_EEEE
  53.             Threads assigned to the cpuset will attempt to assign memory only
  54.             from nodes within the cpuset.  Assignment of memory from outside
  55.             the cpuset will occur only if no free memory is available from
  56.             within the cpuset.  Threads not assigned to the cpuset will not
  57.             use memory from within the cpuset unless no memory outside the
  58.             cpuset is available.  If, at the time a cpuset is created, memory
  59.             is already assigned to threads that are already running, no
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))                                              ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))
  71.  
  72.  
  73.  
  74.             attempt will be made to explicitly move this memory.  If page
  75.             migration is enabled, the pages will be migrated when the system
  76.             detects that most references to the pages are non-local.
  77.  
  78.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______KKKK_EEEE_RRRR_NNNN_EEEE_LLLL______AAAA_VVVV_OOOO_IIII_DDDD
  79.             The kernel should attempt to avoid allocating memory from nodes
  80.             contained in this cpuset. If kernel memory requests cannot be
  81.             satisfied from outside this cpuset, this option will be ignored
  82.             and allocations will occur from within the cpuset. (This avoidance
  83.             currently extends only to keeping buffer cache away from the
  84.             protected nodes.)
  85.  
  86.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______MMMM_EEEE_MMMM_OOOO_RRRR_YYYY______MMMM_AAAA_NNNN_DDDD_AAAA_TTTT_OOOO_RRRR_YYYY
  87.             The kernel will limit all memory allocations to nodes that are
  88.             contained in this cpuset. If memory requests cannot be satisfied,
  89.             the allocating process will sleep until memory is available. The
  90.             process will be killed if no more memory can be allocated. See
  91.             policies below.
  92.  
  93.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______PPPP_OOOO_LLLL_IIII_CCCC_YYYY______PPPP_AAAA_GGGG_EEEE
  94.             Requires MEMORY_MANDATORY. This is the default policy if no policy
  95.             is specified. This policy will cause the kernel to page user pages
  96.             to the swap file (see _s_w_a_p(1M)) to free physical memory on the
  97.             nodes contained in this cpuset. If swap space is exhausted, the
  98.             process will be killed.
  99.  
  100.      _CCCC_PPPP_UUUU_SSSS_EEEE_TTTT______PPPP_OOOO_LLLL_IIII_CCCC_YYYY______KKKK_IIII_LLLL_LLLL
  101.             Requires MEMORY_MANDATORY. The kernel will attempt to free as much
  102.             space as possible from kernel heaps, but will not page user pages
  103.             to the swap file.  If all physical memory on the nodes contained
  104.             in this cpuset are exhausted, the process will be killed.
  105.  
  106.      The ppppeeeerrrrmmmmffffiiiilllleeee member is the name of the file that defines the access
  107.      permissions for the cpuset queue.  The file permissions of filename
  108.      referenced by permfile define access to the cpuset.  Every time
  109.      permissions need to be checked, the current permissions of this file are
  110.      used.  Thus, it is possible to change the access to a particular cpuset
  111.      without having to tear it down and recreate it, simply by changing the
  112.      access permissions.  Read access to the permfile allows a user to
  113.      retrieve information about a cpuset, while execute permission allows the
  114.      user to attach a process to the cpuset.
  115.  
  116.      The ccccppppuuuu member is a pointer to a ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure.  The memory
  117.      for the ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure is allocated and released when the
  118.      ccccppppuuuusssseeeetttt____QQQQuuuueeeeuuuueeeeDDDDeeeeffff____tttt structure is allocated and released (see
  119.      ccccppppuuuusssseeeettttAAAAllllllllooooccccQQQQuuuueeeeuuuueeeeDDDDeeeeffff(3x)). The ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure contains the
  120.      list of CPUs assigned to the cpuset.  The ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure
  121.      (defind in <cpuset.h>) is defined as follows:
  122.  
  123.                typedef struct {
  124.                    int     count;
  125.                    cpuid_t *list;
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))                                              ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))
  137.  
  138.  
  139.  
  140.                } cpuset_CPUList_t;
  141.  
  142.  
  143.      The ccccoooouuuunnnntttt member defines the number of CPUs contained in the list.
  144.  
  145.      The lllliiiisssstttt member is pointer to the list (an allocated array) of the CPU
  146.      IDs.  The memory for the lllliiiisssstttt array is allocated and released when the
  147.      ccccppppuuuusssseeeetttt____CCCCPPPPUUUULLLLiiiisssstttt____tttt structure is allocated and released.
  148.  
  149. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  150.      This example creates a cpuset queue that has access controled by the file
  151.      /usr/tmp/mypermfile, contains CPU IDs 4, 8, and 12, is CPU exclusive and
  152.      memory exclusive:
  153.  
  154.                cpuset_QueueDef_t *qdef;
  155.                char              *qname = "myqueue";
  156.  
  157.                /* Alloc queue def for 3 CPU IDs */
  158.                qdef = cpusetAllocQueueDef(3);
  159.                if (!qdef) {
  160.                    perror("cpusetAllocQueueDef");
  161.                    exit(1);
  162.                }
  163.  
  164.                /* Define attributes of the cpuset */
  165.                qdef->flags = CPUSET_CPU_EXCLUSIVE
  166.                            | CPUSET_MEMORY_EXCLUSIVE;
  167.                qdef->permfile = "/usr/tmp/mypermfile"
  168.                qdef->cpu->count = 3;
  169.                qdef->cpu->list[0] = 4;
  170.                qdef->cpu->list[1] = 8;
  171.                qdef->cpu->list[2] = 12;
  172.  
  173.                /* Request that the cpuset be created */
  174.                if (!cpusetCreate(qname, qdef)) {
  175.                    perror("cpusetCreate");
  176.                    exit(1);
  177.                }
  178.                cpusetFreeQueueDef(qdef);
  179.  
  180.  
  181. NNNNOOOOTTTTEEEESSSS
  182.      _c_p_u_s_e_t_C_r_e_a_t_e is found in the library "libcpuset.so", and will be loaded
  183.      if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  184.  
  185. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  186.      cpuset(1), cpusetAllocQueueDef(3x), cpusetFreeQueueDef(3x).  cpuset(5).
  187.  
  188. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  189.      If successful, _c_p_u_s_e_t_C_r_e_a_t_e returns a 1.  If _c_p_u_s_e_t_C_r_e_a_t_e fails, it
  190.      returns the value 0 and eeeerrrrrrrrnnnnoooo is set to indicate the error.  The possible
  191.      values for eeeerrrrrrrrnnnnoooo include those values set by ffffooooppppeeeennnn(3S), ssssyyyyssssmmmmpppp(2), and the
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))                                              ccccppppuuuusssseeeettttCCCCrrrreeeeaaaatttteeee((((3333xxxx))))
  203.  
  204.  
  205.  
  206.      following:
  207.  
  208.      EEEENNNNOOOODDDDEEEEVVVV
  209.           Request for CPU IDs that do not exist on the system.
  210.  
  211.      EEEEPPPPEEEERRRRMMMM
  212.           Request for CPU 0 as part of an exclusive cpuset is not permitted.
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.